<?php
/**
 * Created: 数据工厂
 * User: lisgroup
 * Time: 2017/5/21 15:49
 */
namespace lisfw\DB;

class Db {
    public static function factor($configKey = 'DB_CONFIG')
    {
        //根据参数加载不同的数据库操作类
        $type = strtolower($GLOBALS['config'][$configKey]['DB_TYPE']);
        switch ($type) {
            case 'mysql':
                $className = 'Mysql';
                break;
            default :
                die('Error : Database Type Not Found');
        }
        $className = '\lisfw\DB\\' . $className ;
        return new $className($configKey);
    }
}
